<template>
	
	<span class="btn">
		<el-button type="warning"  v-if="qq==1"  :icon="JiaoFei" @click="add" style="margin-bottom: 10px;width:100%;margin-top:10px;">该月物业费还没交，去缴费</el-button>
		<el-tag type="warning"  v-else plain :icon="JiaoFei" style="margin-bottom: 10px;width:100%;height:32px;margin-top:10px;">该月物业费已交</el-tag>
	</span>
	<div>
		<el-dialog v-model="dialog.show" title="物业缴费"  width="400px" :close-on-click-modal="false">
			<div><Add 
			v-if="dialog.show"
			v-model:show="dialog.show"
			@getTableData="getTableData"
			/></div>
		</el-dialog>
		  <el-table :data="tableData.records"  border style="width: 100%">
			 <el-table-column label="我的缴费记录" align="center">
		    <el-table-column prop="paymentTime" label="缴费时间" align="center" width="250px">
		    </el-table-column>
		    <el-table-column label="缴费说明" align="center">
			  包含：绿化养护、清洁卫生、秩序维护、公共设施日常维护、办公费用等经业主同意的费用
		    </el-table-column>
			<el-table-column prop="amount" label="缴费金额" align="center" width="200px">
			  ￥50.00
			</el-table-column>
			</el-table-column>
		</el-table>
		<el-pagination
		background
		:page-count="tableData.pages"
		v-model:current-page="params.page"
		:total="tableData.total"
		:close-on-click-modal="false"
		@current-change="getTableData()"
		style="margin-top:30px;"></el-pagination>
	</div>
</template>

<script setup>
import JiaoFei from '@/views/service/components/icon/jiaofei'
import { ref,reactive,computed } from 'vue'
import Add from './add'
import { get, post } from '@/plugins/axios'
import {_axios} from '@/plugins/axios'
import { getCookieForObject} from '@/util';
const amount=ref(0)
const qq=ref(0)
const dialog = reactive({
	show: false,
	title: '',
	id: null
})
	const tableData = reactive({
	  records: [] ,// 初始化为空数组
	  pages: 0,
	  total: 0
	});
	const params = reactive({
	    page: 1,
	    limit: 10
	})
init()
function init(){
    const user=getCookieForObject('user')
    amount.value=user.account
}
function getUserId(){
	const userinfo= getCookieForObject('user')
    return userinfo.id
	}
	const userId=getUserId()
getTableData()
function getTableData(){
		post('/propertyFee/llist',{userId:userId,pageNo:params.page, pageSize:params.limit },content=>{
				tableData.records = content.records
			    tableData.pages = content.pages
			    tableData.total = content.total			
				})
				 checkt()
	}
	
function checkt(){
	post('/propertyFee/checkt',{userId:userId},content=>{
		console.dir(content)
		if(content==true){
			qq.value=1
		}else{
			qq.value=0;
		}
	})
}
function add()
{
	dialog.show=true
}
	
</script>

<style scoped lang="scss">
</style>